<template>
  <div>
    <Echart
      :options="options"
      height="240px"
      width="470px"
    />
  </div>
</template>

<script>
import Echart from '../../../common/echart'

export default {
  components: {
    Echart
  },
  // 这里是预留给你传数据的
  props: {
    cdata: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      options: {}
    }
  },
  watch: {
    cdata: {
      handler() {
        const _this = this
        this.options = {
          grid: {
            left: '5%',
            right: '10%',
            top: '20%',
            bottom: '15%',
            containLabel: true
          },
          tooltip: {
            show: true,
            trigger: 'item'
          },
          xAxis: [
            {
              type: 'category',
              boundaryGap: false,
              axisLabel: {
                color: '#fff'
              },
              axisLine: {
                show: true,
                lineStyle: {
                  color: 'rgba(30,53,119,0.2)'
                }
              },
              axisTick: {
                show: false
              },
              splitLine: {
                show: false,
                lineStyle: {
                  color: 'rgba(30,53,119,0.2)'
                }
              },
              data: [
                'A公司',
                'B公司',
                'C公司'
              ]
            }
          ],
          yAxis: [
            {
              type: 'value',
              name: '评分',
              axisLabel: {
                formatter: '{value}',
                textStyle: {
                  color: '#7495CB'
                }
              },
              axisLine: {
                lineStyle: {
                  color: '#1E3577'
                }
              },
              axisTick: {
                show: false
              },
              splitLine: {
                show: true,
                lineStyle: {
                  color: '#1E3577'
                }
              }
            }
          ],
          series: [
            {
              name: '已采纳',
              type: 'line',
              stack: '总量',
              symbol: 'circle',
              itemStyle: {
                normal: {
                  color: '#00D8FF',
                  lineStyle: {
                    color: '#00D8FF',
                    width: 1
                  },
                  areaStyle: {
                    color: new _this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
                      {
                        offset: 0,
                        color: 'rgba(30,53,119,1)'
                      },
                      {
                        offset: 1,
                        color: 'rgba(30,53,119,0.2)'
                      }
                    ])
                  }
                }
              },
              markPoint: {
                itemStyle: {
                  normal: {
                    color: '#00D8FF'
                  }
                }
              },
              data: [120, 132, 101]
            }
          ]
        }
      },
      immediate: true,
      deep: true
    }
  }
}
</script>
